import { IsIn, IsNotEmpty, IsNumber, IsOptional, Min } from 'class-validator';

export class registeredUsersDto {
  @IsNotEmpty({ message: '用户名不能为空' })
  readonly username: string;
  @IsNotEmpty({ message: '密码不能为空' })
  readonly password: string;
  @IsOptional()
  readonly age: number;
  @IsOptional()
  @IsIn(['男', '女'], { message: '性别只能为男或女' })
  readonly sex: string;
  @IsOptional()
  readonly email: string;
  @IsNotEmpty({ message: '手机号不能为空' })
  readonly phone: string;
  @IsOptional()
  readonly state: number;
}

export class getAllUserBodyDto {
  @IsOptional()
  @Min(1, { message: '页数最小为1' })
  @IsNumber({}, { message: '页数必须为数字' })
  pageSize: number;

  @IsOptional()
  @Min(1, { message: '页码最小为1' })
  @IsNumber({}, { message: '页码必须为数字' })
  pageNum: number;

  @IsOptional()
  @IsNumber({}, { message: '用户状态必须为数字' })
  readonly userState: number;
}
